﻿#region zh-CHS 2006 - 2007 DemoSoft 团队 | en 2006 - 2007 DemoSoft Team

//     NOTES
// ---------------
//
// This file is a part of the G.O.S.E(Game Online Server Engine) for .NET.
//
//                 2006-2007 DemoSoft Team
//
//
// First Version : by H.Q.Cai - mailto:caihuanqing@hotmail.com

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

#region zh-CHS 包含名字空间 | en Include namespace
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Demo_G.O.S.E.ServerEngine.Common;
#endregion

namespace Demo_G.O.S.E.ServerEngine.Network.DLL
{
    /// <summary>
    /// 服务端监听时需要调用的初始化处理
    /// </summary>
    [MultiThreadedSupportgAttribute( "当前的类所有成员都可锁定,支持多线程操作" )]
    public class ServerInit
    {
        #region zh-CHS 共有静态属性 | en Public Static Properties
        /// <summary>
        /// 服务端的是否已初始化
        /// </summary>
        public static bool IsInit
        {
            get { return ServerInit.Server_IsInit(); }
        }
        #endregion

        #region zh-CHS 共有静态方法 | en Public Static Methods
        /// <summary>
        /// 服务端的初始化
        /// </summary>
        /// <param name="SERVER_CACHED_SIZE"></param>
        /// <param name="SERVER_BUFFER_SIZE"></param>
        /// <param name="SERVER_MANAGE_THREAD_POOL_SIZE"></param>
        /// <param name="SERVER_SEND_THREAD_POOL_SIZE"></param>
        /// <param name="SERVER_RECEIVE_THREAD_POOL_SIZE"></param>
        /// <param name="SERVER_PROCESS_THREAD_POOL_SIZE"></param>
        /// <param name="SERVER_MAX_CLIENTS"></param>
        /// <param name="SERVER_OUT_TIME_INTERVAL"></param>
        public static void Init(int SERVER_CACHED_SIZE, int SERVER_BUFFER_SIZE, int SERVER_MANAGE_THREAD_POOL_SIZE, int SERVER_SEND_THREAD_POOL_SIZE, int SERVER_RECEIVE_THREAD_POOL_SIZE, int SERVER_PROCESS_THREAD_POOL_SIZE, int SERVER_MAX_CLIENTS, int SERVER_OUT_TIME_INTERVAL)
        {
            ServerInit.Server_Init(SERVER_CACHED_SIZE, SERVER_BUFFER_SIZE, SERVER_MANAGE_THREAD_POOL_SIZE, SERVER_SEND_THREAD_POOL_SIZE, SERVER_RECEIVE_THREAD_POOL_SIZE, SERVER_PROCESS_THREAD_POOL_SIZE, SERVER_MAX_CLIENTS, SERVER_OUT_TIME_INTERVAL);
        }

        /// <summary>
        /// 服务端的缺省初始化
        /// </summary>
        public static void InitDefault()
        {
            ServerInit.Server_InitDefault();
        }

        /// <summary>
        /// 服务端的结束
        /// </summary>
        public static void Fini()
        {
            ServerInit.Server_Fini();
        }
        #endregion

        #region zh-CHS 引入DLL接口 | en DLL Import
        /// <summary>
        /// dll 调用
        /// </summary>
        /// <param name="SERVER_CACHED_SIZE"></param>
        /// <param name="SERVER_BUFFER_SIZE"></param>
        /// <param name="SERVER_MANAGE_THREAD_POOL_SIZE"></param>
        /// <param name="SERVER_SEND_THREAD_POOL_SIZE"></param>
        /// <param name="SERVER_RECEIVE_THREAD_POOL_SIZE"></param>
        /// <param name="SERVER_PROCESS_THREAD_POOL_SIZE"></param>
        /// <param name="SERVER_MAX_CLIENTS"></param>
        /// <param name="SERVER_OUT_TIME_INTERVAL"></param>
        [DllImport("Demo G.O.S.E.Net.dll", CallingConvention = CallingConvention.StdCall)]
        private static extern void Server_Init(int SERVER_CACHED_SIZE, int SERVER_BUFFER_SIZE, int SERVER_MANAGE_THREAD_POOL_SIZE, int SERVER_SEND_THREAD_POOL_SIZE, int SERVER_RECEIVE_THREAD_POOL_SIZE, int SERVER_PROCESS_THREAD_POOL_SIZE, int SERVER_MAX_CLIENTS, int SERVER_OUT_TIME_INTERVAL);

        /// <summary>
        /// dll 调用
        /// </summary>
        [DllImport("Demo G.O.S.E.Net.dll", CallingConvention = CallingConvention.StdCall)]
        private static extern void Server_InitDefault();

        /// <summary>
        /// dll 调用
        /// </summary>
        [DllImport("Demo G.O.S.E.Net.dll", CallingConvention = CallingConvention.StdCall)]
        private static extern void Server_Fini();

        /// <summary>
        /// dll 调用
        /// </summary>
        /// <returns></returns>
        [DllImport("Demo G.O.S.E.Net.dll", CallingConvention = CallingConvention.StdCall)]
        private static extern bool Server_IsInit();
        #endregion
    }
}
#endregion

